<?php
namespace Helper;

/**
 * All the $keys must exists in $array
 * 
 * @param array $array
 * @param array $keys 
 */
function array_isset(array $array, array $keys)
{
    foreach ($keys as $key)
    {
        if ( ! array_key_exists($key, $array))
        {
            throw new \Exception("array_isset - {$key} is not in the \$array");
        }
    }
}

/**
 * Loads a db model (include)
 * 
 * @param string $module
 * @param string $model 
 */
function loadModel($module, $model)
{
    \Zend_Loader::loadFile(\MODELS_PATH . "/{$module}/{$model}.php");
}

/**
 * Load an i18n dictionary
 *
 * @param string $module
 * @param string $dict 
 */
function loadI18n($module, $dict)
{
    \ZReg::get('i18n')->load("{$module}/{$dict}");
}